#include<iostream>
using namespace std;

int main()
{
	int n;
	cin >> n;
	int ans = 0;
	int arr[10];
	int k = 0;
	for (int i = 1; i <= n; i++)
	{
		int j = 1;
		int flag = 0;
		int tmp = i;
		while (tmp)
		{
			flag++;
			tmp /= 10;
		}
		tmp = i;
		int z = 1;
		while (flag)
		{
			int num = tmp % 10;
			if (z % 2 != 0)
			{
				if (num % 2 == 0)
				{
					j = 0;
					break;
				}
			}
			if (z % 2 == 0)
			{
				if (num % 2 != 0)
				{
					j = 0;
					break;
				}
			}
			tmp /= 10;
			--flag;
			++z;
		}
		if (j == 1)
		{
			ans++;
			arr[k] = i;
			k++;
		}
	}
	cout << ans;
	return 0;
}